<%= form_for(@oid) do |f| %>
  <% if @oid.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@oid.errors.count, "error") %> prohibited this oid from being saved:</h2>

      <ul>
      <% @oid.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <%= f.hidden_field "host_id", :value => @host.id %>
  <div class="oid_field">
    <%= f.label :name %><br />
	<%= f.text_field :name, :size => 10 %>
  </div>
  <div class="oid_field">
    <%= f.label :value %><br />
    <%= f.text_field :value, size: 21 %>
  </div>
  <div class="oid_field">
    <%= f.label 'pooling time (s)'%><br />
	<%= f.text_field :time_period, :size => 10 %>
  </div>
  <div class='cleaner'></div>

  <div class="actions">
    <% if @oid.persisted? %>
      <%= link_to 'Update', @oid, method: :put, data: {confirm: 'Are you sure?' } %>
	    <%= link_to 'Destroy', @oid, method: :delete, data: { confirm: 'Are you sure?' } %>
    <% else %>
      <%= f.submit %>
    <% end %>
  </div>

  <% if @oid.persisted? %>
    <div class="graph">
      <%= image_tag @oid.get_graph, :alt => "No graph found" %>
    </div>

    <div class="oid_activate">
      <% if @oid.active? %>
        <span class="oid_active">Running. <%= link_to "Deactivate", deactivate_oid_path(@oid), :method => :post %></span>
      <% else %>
        <span class="oid_not_active">Stopped. <%= link_to "Activate", activate_oid_path(@oid), :method => :post %></span>
      <% end %>
    </div>
  <% end %>

<% end %>
